UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fHIjDLEeUoQunc+DSoTDEF/yL3MlLl5qNf9ENVdtAuM=' 
WHERE 
  key_id = '078a15539aa5f02e56c9655520489e4f65a4304940fc1fe16816e518d47fe921' 
  AND (
    token = 'fHIjDLEeUoQunc+DSoTDEF/yL3MlLl5qNf9ENVdtAuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048