UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zg+0oNGuLyTcIAd6rthoVkpQh6VLrwK3hzyfEBIn7vE=' 
WHERE 
  key_id = '8d8c9e09d178041b38f91ed3a2dc19b1465beeda774bdd0593e7ff4619698f6a' 
  AND (
    token = 'Zg+0oNGuLyTcIAd6rthoVkpQh6VLrwK3hzyfEBIn7vE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055