UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fWhWhi9Rnpdw+lr0TxnA5GvFKV2DFQMFeGGF5/wcHbY=' 
WHERE 
  key_id = 'f91ec61cc5b69f46169892e494e9b9d8dfa4f926675a5d92921c82d7e68bee6f' 
  AND (
    token = 'fWhWhi9Rnpdw+lr0TxnA5GvFKV2DFQMFeGGF5/wcHbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045