UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uN/RnVR4MHNVSPOWr1j6xUx26ozNCwVl+G/VMIZth3s=' 
WHERE 
  key_id = 'ea201a28ea1efc3311647d296403edbe150fc1a667fc53e7170c9ffc528648dd' 
  AND (
    token = 'uN/RnVR4MHNVSPOWr1j6xUx26ozNCwVl+G/VMIZth3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030