UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm5Ie9bDFSurmJPsI6Rh0rX9KgbrfhXGmuOqcYP3FgL4=' 
WHERE 
  key_id = '4c0e22a2f73e6ca9427f905542413896861d6ab7d022733ae62a37ae86ed60fc' 
  AND (
    token = 'm5Ie9bDFSurmJPsI6Rh0rX9KgbrfhXGmuOqcYP3FgL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049