UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oiBN4qNHZIA+9l9Fa+hzLADapVpppikWtvgX2nTlk3U=' 
WHERE 
  key_id = '27232ef9afa8815f34cf6e5999ef3005368094a3b5e7a36129c352452fd7956f' 
  AND (
    token = 'oiBN4qNHZIA+9l9Fa+hzLADapVpppikWtvgX2nTlk3U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028