UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q1QkIeu0E8+tzBwY09V+vsq3bUf0qyYeKIgNXJ5ILVI=' 
WHERE 
  key_id = '8e5177ddf4c04913b4ee65673e491ad9b1f4c53e673dac789aecc303ef97269c' 
  AND (
    token = 'Q1QkIeu0E8+tzBwY09V+vsq3bUf0qyYeKIgNXJ5ILVI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030