UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't4CYxIQyPsNjiusS76hOda3NoEmiWeChLT1fbFp9HUU=' 
WHERE 
  key_id = '1c36752706bd55f4498a59f0863886beda4339b309f87349871a0522bbfae591' 
  AND (
    token = 't4CYxIQyPsNjiusS76hOda3NoEmiWeChLT1fbFp9HUU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048