UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tP/t0EEXEBMvceRqcS6/NF14NAclkf+f7moVRjZfi6s=' 
WHERE 
  key_id = '643ca60a2f50eba54e7306092a18a66e21597379620d2136dbdc2f26ef40a435' 
  AND (
    token = 'tP/t0EEXEBMvceRqcS6/NF14NAclkf+f7moVRjZfi6s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028