UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3M0dHBg8z+Dkec6xJoBV3zX6hSuFoQEjUkNXTihE6Ns=' 
WHERE 
  key_id = 'd41f01b7fc2cc23fd847f568ae190b6c356709d19420cd83138f1e1e9f8b8fcd' 
  AND (
    token = '3M0dHBg8z+Dkec6xJoBV3zX6hSuFoQEjUkNXTihE6Ns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039