UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q83mFbmPWtHUzWSo61vXyyDP9IMuqehqWw6P/IWr+mA=' 
WHERE 
  key_id = 'fa37fdce7290b9c85e8fe9742206d23ae5f33e0c9681cacdccedc90eaeb58e96' 
  AND (
    token = 'Q83mFbmPWtHUzWSo61vXyyDP9IMuqehqWw6P/IWr+mA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026