UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2Oc89KIb1PdAphRCzRbzJeLOiQYOL+lCiW1p0eqsRHM=' 
WHERE 
  key_id = '956a258e8c0700ee2d2a9394a49aeff7d2a576af8dc9170277050991c695bedf' 
  AND (
    token = '2Oc89KIb1PdAphRCzRbzJeLOiQYOL+lCiW1p0eqsRHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023