UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm9yJpQoY1ZKfOIPPyfbCJQJhWxngzw2nosPEsIGoUTU=' 
WHERE 
  key_id = '8d503d15646ce996d0de2e42bc6866a1ed75adf35f1686d48726c31e887e2b80' 
  AND (
    token = 'm9yJpQoY1ZKfOIPPyfbCJQJhWxngzw2nosPEsIGoUTU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041