UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dE4LsiVugURcKjwn8QeCMm9k88n2lvtgQ0DONp/q+9M=' 
WHERE 
  key_id = '64b1afddca99e76f49f741c3e323e3b2c5141b057c0d61cc70839384ded5651e' 
  AND (
    token = 'dE4LsiVugURcKjwn8QeCMm9k88n2lvtgQ0DONp/q+9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041