UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KVqQVgp8YgkjIuyOoL3Va7jKG4KJLDQRVi/ugZ9IT9M=' 
WHERE 
  key_id = '2a47b0c9c6d4ab6ff951a91d62311c28238b58ecad21452692bed67c7f2b7344' 
  AND (
    token = 'KVqQVgp8YgkjIuyOoL3Va7jKG4KJLDQRVi/ugZ9IT9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032