UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BHAIfkkywqzk6uEggPLtgbwTA6vl9T+xJ47Bz2W2ItY=' 
WHERE 
  key_id = 'b12371bb15e8f75a11126d717a4accfccd082d4ccf4d94fbe05ad1c66f695b20' 
  AND (
    token = 'BHAIfkkywqzk6uEggPLtgbwTA6vl9T+xJ47Bz2W2ItY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032