UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mo28BmCpPzBMgrTAF6zUbB96RU41mFfQ9VuWL+eLAx8=' 
WHERE 
  key_id = 'c1f76123b8258ec844e5e8244f7e885038f840d03cbeffb065b3e914e03e4727' 
  AND (
    token = 'Mo28BmCpPzBMgrTAF6zUbB96RU41mFfQ9VuWL+eLAx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025