UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BQu2C5yHw5ZeLQA1S1gXfWd7TTIBX889I9FbTEfMCSI=' 
WHERE 
  key_id = '6837449349351369a60b4aa1c149af299750ed6c48322ec5b56247d59df31189' 
  AND (
    token = 'BQu2C5yHw5ZeLQA1S1gXfWd7TTIBX889I9FbTEfMCSI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033