UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZDsA4lP4MkvvKmjb87X61nFJ2H+PdbgDDeEfgWVqeWE=' 
WHERE 
  key_id = '10fd12d4d39ca6c36b849c5dd1141b4035c1b119286448def27c405b8e942f5d' 
  AND (
    token = 'ZDsA4lP4MkvvKmjb87X61nFJ2H+PdbgDDeEfgWVqeWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029