UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g7hVecU8Wf/Fu8ohp+aGF6UX8UWJvc6beNPAVY3Aa9U=' 
WHERE 
  key_id = '8e4fc902de92afd597f51b02193b83f81e6340a9b141419b334a2efdca5c8a7b' 
  AND (
    token = 'g7hVecU8Wf/Fu8ohp+aGF6UX8UWJvc6beNPAVY3Aa9U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025