UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a+BBIwZMqeOW+k3uJVylOGoi4yxNBh8ROfyjARKbrbs=' 
WHERE 
  key_id = '2131c0b579d1d407ccfb9356469779155346caad921efc08f7e522d3a7267e75' 
  AND (
    token = 'a+BBIwZMqeOW+k3uJVylOGoi4yxNBh8ROfyjARKbrbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034