UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bPruEtprHltp19agk5AFH7sDvhcK0qXqyWVVrj3KkXI=' 
WHERE 
  key_id = '49c2e4b73e604bbde8bb16b473d9a67d8f204d9584072199ae0fa35499d89486' 
  AND (
    token = 'bPruEtprHltp19agk5AFH7sDvhcK0qXqyWVVrj3KkXI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043