UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hau4K1CnxGC/GBYCfFpqQwv73nncZKmrJI3DdMCN+dQ=' 
WHERE 
  key_id = '9c168210d2867ff14fe98ad7a1364a5102227d1d09093389c7ce7747953e1522' 
  AND (
    token = 'Hau4K1CnxGC/GBYCfFpqQwv73nncZKmrJI3DdMCN+dQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033