UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RalD0QBYX8azTlHXMvFULI+7Fag3zmM2PsLCam371Tk=' 
WHERE 
  key_id = '2f5f75d0f5e90c6e1f692cd0bfba34707535c53b4fcdcd6fa28750cdfcb3005e' 
  AND (
    token = 'RalD0QBYX8azTlHXMvFULI+7Fag3zmM2PsLCam371Tk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025