UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pg2e1bNe8vC6ME1KGZ81mI30NwfwDUpWO+KcMLaI0Vk=' 
WHERE 
  key_id = '269abb5137d115d16e969dc1d29684cdd71db6e4600a70657f1c6f52ab28e620' 
  AND (
    token = 'pg2e1bNe8vC6ME1KGZ81mI30NwfwDUpWO+KcMLaI0Vk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021