UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BEVk8XyadMH5HL5gZBxKR4G8KnLFzyxoaFAJ/Pd0bSc=' 
WHERE 
  key_id = 'e59f1da2b1f9afee415b43e03d47d692454cedcee8dbe90500e42f95b27b560b' 
  AND (
    token = 'BEVk8XyadMH5HL5gZBxKR4G8KnLFzyxoaFAJ/Pd0bSc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036