UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zoNlE4mbl1m8rQnthv3c+TKlIWirf30cn8F/FGtAg+k=' 
WHERE 
  key_id = '54a8b87683412d2bdb2aff541086d749308fa48eab5b6fc31c5595c7f16a87fb' 
  AND (
    token = 'zoNlE4mbl1m8rQnthv3c+TKlIWirf30cn8F/FGtAg+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022