UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hBBhpRDj/xK8gUJOH87Hqkm1mnynBirf5aKJT+m7R2s=' 
WHERE 
  key_id = '3a1eff69ae3c6c137c10f42450e54751a8254a2d7c1be2d0aa932b8d81f23025' 
  AND (
    token = 'hBBhpRDj/xK8gUJOH87Hqkm1mnynBirf5aKJT+m7R2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026