UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's9NffndDcFPI69VNmYzN+HsvzdGliYKVpN4ml0zsyuM=' 
WHERE 
  key_id = '06a9c94914f32f629d04c2aeb59cc8addbce30242a874de896a1240be51bde19' 
  AND (
    token = 's9NffndDcFPI69VNmYzN+HsvzdGliYKVpN4ml0zsyuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037