UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rHq7AcA3iHS/w1W0t1GsGdF4NqvTPJHO+2IyS9Co/2Q=' 
WHERE 
  key_id = '9f4c99d3aee1d487727cd41bc3564779c810ad1f66b7c650387f62bd56965aa2' 
  AND (
    token = 'rHq7AcA3iHS/w1W0t1GsGdF4NqvTPJHO+2IyS9Co/2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032