UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QTHWePq6gTU3k1JwCrMZmKk7mc+3HwL1XvqnckOtfsg=' 
WHERE 
  key_id = '71fda4dadcb40abfb1d211de0f2689a4fc7df071582bb3156c6671d030127d43' 
  AND (
    token = 'QTHWePq6gTU3k1JwCrMZmKk7mc+3HwL1XvqnckOtfsg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040