UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HV5OtFoqsiHuKKmJbw4Kofi7E78sx9nHp3Me32xEaXQ=' 
WHERE 
  key_id = '3210ef1ba6ac194732ba0b0e48d9240a82350059d4aba32daf9ec270d7ec8a2b' 
  AND (
    token = 'HV5OtFoqsiHuKKmJbw4Kofi7E78sx9nHp3Me32xEaXQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030