UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YNFxAkGH0q8JRVcR7LkT9EjSi6TbrNanEhYfXNVDpQo=' 
WHERE 
  key_id = '02abebfb1e78336591acecee55d20c2f9d8d3372d7855c5290cfb7527fd83800' 
  AND (
    token = 'YNFxAkGH0q8JRVcR7LkT9EjSi6TbrNanEhYfXNVDpQo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052