UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y1Q+UG1bG2wSOUtF4C1fZ/riE1aBPxLX+XGGZjpKwMQ=' 
WHERE 
  key_id = '16b5de806ea63c853b3ab134bfed7eb7f4108c9346d957aa0bf1317e38ec01df' 
  AND (
    token = 'Y1Q+UG1bG2wSOUtF4C1fZ/riE1aBPxLX+XGGZjpKwMQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033