UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '342mGPmFPbdfl4qQq7sH9TMyDD872qcJ1dL53m2jaYI=' 
WHERE 
  key_id = '512859c51c45aec7e14b093f80e7c2874a5657447dac4a3fb03875bb1ccde93c' 
  AND (
    token = '342mGPmFPbdfl4qQq7sH9TMyDD872qcJ1dL53m2jaYI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042