UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fu0PvJmV28y/gONk+vdYEhV4DP1OulKArewjRGKVfHc=' 
WHERE 
  key_id = '36692de40753e51be29a2a623ea037f6009abd6433545765ce173a38e3c7d949' 
  AND (
    token = 'fu0PvJmV28y/gONk+vdYEhV4DP1OulKArewjRGKVfHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018