UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v37PY10fbI7Tp6ZgCVBSKpilnADt+Ee1RiwPfmxxoZ8=' 
WHERE 
  key_id = '37dfde6e481df612101ae11357253a62a4d1a74c09dab18018b7502a240b03a4' 
  AND (
    token = 'v37PY10fbI7Tp6ZgCVBSKpilnADt+Ee1RiwPfmxxoZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047