UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HDh7q76OOyy731xMajVPB59poj5655J58X08cUv3qx8=' 
WHERE 
  key_id = '00a35a64cf6db30a0da6b3b95a5379541e35c9ad45c334e9ac474c4ebdb73e79' 
  AND (
    token = 'HDh7q76OOyy731xMajVPB59poj5655J58X08cUv3qx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016