UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wwJTDpTmMi0Fbv+zR+NdbHxoj0edJw/B9k7iaTnqTAA=' 
WHERE 
  key_id = '866731fc692286ad41aa42da29ddd9c5be0d2ccf33c0562843ffb15d47776f1e' 
  AND (
    token = 'wwJTDpTmMi0Fbv+zR+NdbHxoj0edJw/B9k7iaTnqTAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017