UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vM4CMymh0TU3GUbtCVgo6iKNJhVCBkog8wTjpnguioo=' 
WHERE 
  key_id = '626327274084a0a3a3defc633c6bcead4db59e5ce3acaf2b221bd6c1b2829d7d' 
  AND (
    token = 'vM4CMymh0TU3GUbtCVgo6iKNJhVCBkog8wTjpnguioo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031